package com.xiuxian;

import com.xiuxian.model.User;
import com.xiuxian.util.MybatisUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MainFunction {
    public static void main(String[] args) {

        //1.获取sqlsession
        SqlSession sqlSession = null;
        try {
        sqlSession = MybatisUtils.getSqlSession();
        List<User>  users =  sqlSession.selectList("test.getAll");
       users.forEach(user -> {
           System.out.println(user);
       });
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            MybatisUtils.close(sqlSession);
        }
    }

}
